import { Navigate, RouterProvider, createHashRouter} from 'react-router-dom';
import Dashboard from './pages/dashboard';
import OrderList from './pages/orderList';
import MuseumUser from './pages/museumUser';
import PalaceUser from './pages/palaceUser';
import TaskList from './pages/taskList';
import UserList from './pages/userList';
import AddPlaceUser from './pages/addPlaceUser';
import PayPalaceOrder from './pages/payPalaceOrder';
import Login from './pages/login';
import Layout from './layouts';

const router = createHashRouter([
  { path: '/addPlaceUser', element: <AddPlaceUser /> },
  { path: '/payPalaceOrder', element: <PayPalaceOrder /> },
  { path: '/login', element: <Login /> },
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: '/',
        element: <Dashboard /> 
      },
      {
        path: '/dashboard',
        element: <Dashboard /> 
      },
      {
        path: '/orderList',
        element: <OrderList /> 
      },
      {
        path: '/userList',
        element: <UserList /> 
      },
      {
        path: '/museumUser',
        element: <MuseumUser /> 
      },
      {
        path: '/palaceUser',
        element: <PalaceUser /> 
      },
      {
        path: '/taskList',
        element: <TaskList /> 
      },
      { path: '*', element: <Navigate to='/dashboard' replace /> }
    ],
  },
]);

const Routers = () => <RouterProvider router={router} />

export default Routers;
